const {ccclass, property} = cc._decorator;

enum ACTION {
    DESTROY,
    HIDE
}

@ccclass
export default class NewClass extends cc.Component {

    @property
    timer : number = 0;

    @property({type : cc.Enum(ACTION)})
    action : ACTION = ACTION.HIDE;

    onEnable(){
        if(this.timer > 0){
            this.scheduleOnce(()=>{
                if(this.action === ACTION.HIDE){
                    this.node.active = false;
                }
                if(this.action === ACTION.DESTROY){
                    this.node.destroy();
                }
            }, this.timer)
        }
    }
}
